/*********************
 ***    DumpGp.c   ***
 *********************/
#include	<stdio.h> 
#include	<stdarg.h>
#include	"Uigp/igp.h"

#include	"Log.h"

static FILE *fpLog = NULL;

void
gpLog_openR( char *dir, char *fname )
{
char	file[256];

	sprintf( file, "%s/%s", dir, fname  );

	gpLog_open( file );
}

void
gpLog_open( char *file )
{
	fpLog = fopen( file, "w" );
}


void
gpLog_close()
{
	if( fpLog == NULL )	return;

	fclose( fpLog );
}


void gpLog( const char *format, ... )
{
va_list args;

	if( fpLog == NULL )	return;


	
	va_start(args, format);

	vfprintf( fpLog, format, args);
}



void gpTrace( int mode, const char *format, ... )
{
va_list args;

	va_start(args, format);

	if( mode & 1 )
		vfprintf( stdout, format, args);


	if( mode & 0x2 && fpLog != NULL )
		vfprintf( fpLog, format, args);
}
